<!--
 * @Description: 字体图标组件
 * @Pramas: iconName 图标名称 className 图标样式
 * @Author: 黄勇
 * @Date: 2019-07-19 10:28:03
 * @LastEditTime: 2020-03-20 15:03:24
 * @LastEditors: 黄勇
 -->
<template>
    <svg :class="svgClass" aria-hidden="true" v-on="$listeners">
        <use :xlink:href="iconHref"></use>
    </svg>
</template>

<script>
    export default {
        name: "SeeyonIcon",
        props: {
            iconName: {
                type: String,
                required: true
            },
            className: {
                type: String,
                default: ""
            }
        },
        computed: {
            iconHref() {
                return `#${this.iconName}`;
            },
            svgClass() {
                if (this.className) {
                    return "svg-icon " + this.className;
                } else {
                    return "svg-icon";
                }
            }
        }
    };
</script>

<style>
    .svg-icon {
        width: 1em;
        height: 1em;
        vertical-align: -0.15em;
        fill: currentColor;
        overflow: hidden;
    }
</style>
